
$(document).ready(function(){
    // '<p class="products_desc"> 对接成功<em>881</em>项需求 </p>'
    var userName = window.localStorage.getItem("admin");
    var regionArr = ["碑林区","莲湖区","灞桥区","雁塔区","阎良区","未央区","新城区","长安区","临潼区"];
    $(".fiUsername").html(userName);
    $.fn.serializeObject = function () {
        var ct = this.serializeArray();
        var obj = {};
        $.each(ct, function () {
            if (obj[this.name] !== undefined) {
                if (!obj[this.name].push) {
                    obj[this.name] = [obj[this.name]];
                }
                obj[this.name].push(this.value || "");
            } else {
                obj[this.name] = this.value || "";
            }
        });
        return obj;
    };
    function queryEnterprise (){
        $(" .search-div").css({
            'display':'block'
        })
        var data=[]
        $(".products-list").remove();
        $(".card-body--padding").append('<div class="products-list"></div>');
        var content = '<form class="form-horizontal" role="form" id="enterpriseForm" style="margin-top:30px;">\n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>统一社会信用代码：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="companycode" name="socialCode" style="width:280px" placeholder="请输入统一社会信用代码"/><span id="errInfo" style="color: red "></span>\n' +
            '                                <a href="#"  onclick="javascript:alert(\'若还没有统一社会信用代码（新版营业执照上有），请填写组织机构代码或者工商注册号。\')">还没有信用代码，点击此处</a>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>企业名称：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="pci_namecn" name="enterpriseName" placeholder="请输入企业名称" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>企业注册资金(万元)：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="number" class="form-control default-input" id="companyRegisterNo" name="registeredCapital" placeholder="请输入企业注册资金" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>所属区县：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<select class="col-sm-7 selectpicker show-tick form-control" id="pci_branchno" name="region" data-live-search="true" style="width:280px">\n' +
            '\t\t\t\t\t\t\t\t\t\n' +
            '\t\t\t\t\t\t\t\t\t<option value="0">0-碑林区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="1">1-莲湖区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="2">2-灞桥区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="3">3-雁塔区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="4">4-阎良区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="5">5-未央区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="6">6-新城区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="7">7-长安区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="8">8-临潼区</option>\n' +
            '\t\t\t\t\t\t\t\t</select>\t\t\t\t\t\t\t\t\t\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>街道/乡镇：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="pci_branchno_town" name="street" placeholder="请输入街道/乡镇名称" style="width:280px"/>\t\t\t\t\t\t\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>法人姓名：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="ownername" name="ownerName" placeholder="请输入法人姓名" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>法人手机号：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="ownerno" name="ownerPhone" maxlength="11"  placeholder="请输入法人手机号" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>联系人姓名：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="username" name="contactName" placeholder="请输入联系人姓名" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>联系人手机号：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="phoneno" name="contactPhone" maxlength="11"  placeholder="请输入联系人手机号" style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>成立时间：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="date" class="form-control default-input" id="establishmentTime" name="establishTime" placeholder="请输入成立时间" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>登录密码：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="password" class="form-control default-input" id="loginpwd" name="password" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>确认密码：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="password" class="form-control default-input" id="affirmpwd" name="affirmpwd" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit">信保基金额度(万元)：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="number" class="form-control default-input" id="fundQuota" name="fundQuota" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit">可用额度(万元)：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="number" class="form-control default-input" id="availableCredit" name="available" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit">注册地址：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="registAddress" name="establishAddress" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\t\t\t\t\t\t\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit">经营范围：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="businessScope" name="businessScop" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit">企业详情：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="enterpriseDesc" name="enterpriseDesc" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit">开户银行：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="accountBank" name="accountBank" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>' +'\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit">电费代码：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="electricityChargeCode" name="electricityChargeCode" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>' +'\t\t\t\t\t\t</div>' +'\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit">社会安全代码：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="socialSecurityCode" name="socialSecurityCode" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>' +
            '</form>'+
            '<div class="btn-wrap" style="width: 150px;margin-right: auto;margin-left: auto">\n' +
            '                            <button id="enterpriseOk" class="products-btn">确定</button>\n' +
            '                            <button id="enterpriseCancel" class="products-btn">取消</button>\n' +
            '                        </div>'
        var content1 = '<form class="form-horizontal" role="form" id="enterpriseForm" style="margin-top:30px;">\n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>统一社会信用代码：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" disabled id="companycode" name="socialCode" style="width:280px" placeholder="请输入统一社会信用代码"/><span id="errInfo" style="color: red "></span>\n' +
            '                                <a href="#"  onclick="javascript:alert(\'若还没有统一社会信用代码（新版营业执照上有），请填写组织机构代码或者工商注册号。\')">还没有信用代码，点击此处</a>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>企业名称：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="pci_namecn" name="enterpriseName" placeholder="请输入企业名称" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>企业注册资金(万元)：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="number" class="form-control default-input" id="companyRegisterNo" name="registeredCapital" placeholder="请输入企业注册资金" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>所属区县：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<select class="col-sm-7 selectpicker show-tick form-control" id="pci_branchno" name="region" data-live-search="true" style="width:280px">\n' +
            '\t\t\t\t\t\t\t\t\t\n' +
            '\t\t\t\t\t\t\t\t\t<option value="0">0-碑林区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="1">1-莲湖区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="2">2-灞桥区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="3">3-雁塔区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="4">4-阎良区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="5">5-未央区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="6">6-新城区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="7">7-长安区</option>\n' +
            '\t\t\t\t\t\t\t\t\t<option value="8">8-临潼区</option>\n' +
            '\t\t\t\t\t\t\t\t</select>\t\t\t\t\t\t\t\t\t\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>街道/乡镇：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="pci_branchno_town" name="street" placeholder="请输入街道/乡镇名称" style="width:280px"/>\t\t\t\t\t\t\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>法人姓名：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="ownername" name="ownerName" placeholder="请输入法人姓名" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>法人手机号：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="ownerno" name="ownerPhone" maxlength="11"  placeholder="请输入法人手机号" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>联系人姓名：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="username" name="contactName" placeholder="请输入联系人姓名" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>联系人手机号：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="phoneno" name="contactPhone" maxlength="11"  placeholder="请输入联系人手机号" style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>成立时间：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="date" class="form-control default-input" id="establishmentTime" name="establishTime" placeholder="请输入成立时间" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit">信保基金额度(万元)：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="number" class="form-control default-input" id="fundQuota" name="fundQuota" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit">可用额度(万元)：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="number" class="form-control default-input" id="availableCredit" name="available" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit">注册地址：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="registAddress" name="establishAddress" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\t\t\t\t\t\t\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit">经营范围：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="businessScope" name="businessScop" style="width:280px"/>\n' +
            '                            </div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit">企业详情：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="enterpriseDesc" name="enterpriseDesc" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit">开户银行：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="accountBank" name="accountBank" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>' +'\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit">电费代码：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="electricityChargeCode" name="electricityChargeCode" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>' +'\t\t\t\t\t\t</div>' +'\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit">社会安全代码：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="socialSecurityCode" name="socialSecurityCode" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>' +
            '</form>'+
            '<div class="btn-wrap" style="width: 150px;margin-right: auto;margin-left: auto">\n' +
            '                            <button id="enterpriseOk" class="products-btn">确定</button>\n' +
            '                            <button id="enterpriseCancel" class="products-btn">取消</button>\n' +
            '                        </div>'
        // $("#enterprise .products-list").append('<div class="search-div btn-wrap" style="margin-bottom: 20px;height: 30px">\n' +
        //     '                        <div style="float: right">\n' +
        //
        //     '                            <input type="search" id="search-enterprise" placeholder="请输入企业名称"/>\n' +
        //     '                            <button  class="products-btn" style="margin-right: 20px" id="search-button">搜索</button>\n' +
        //     '                            <button class="products-btn" style="width:100px" id="add-enterprise">新增企业用户</button>\n' +
        //     '                        </div>\n' +
        //     '                    </div>')
        $('#searchButton')[0].onclick=function (e) {
            var d=$('#search-enterprise').val()
            $(".products-list").remove();
            $(".card-body--padding").append('<div class="products-list"></div>');
            // $("#enterprise .products-list").append('<div class="search-div btn-wrap" style="margin-bottom: 20px;height: 30px">\n' +
            //     '                        <div style="float: right">\n' +
            //
            //     '                            <input type="search" id="search-enterprise" placeholder="请输入企业名称"/>\n' +
            //     '                            <button  class="products-btn" style="margin-right: 20px" id="search-button">搜索</button>\n' +
            //     '                            <button class="products-btn" style="width:100px" id="add-enterprise">新增企业用户</button>\n' +
            //     '                        </div>\n' +
            //     '                    </div>')
            $.ajax({
                type:'POST',
                url:'http://localhost:8888/enterprise/getAllEnterpriseInformation',
                data:{
                    pageNum:1,
                    pageSize:10000,
                    enterpriseName:d
                },
                success:function (result) {
                    if(result.meta.success){
                        // alert("新增用户成功！")
                        // queryEnterprise()
                        console.log(result)
                        $(".products-list").remove();
                        $(".card-body--padding").append('<div class="products-list"></div>');
                        var d1=result.data['enterpriseInfo List'].map(function (item,index) {
                            return '<dl style="padding-top: 0px;" class="products-item insurance three six twelve thirty-six credit unconnect unplicy -ten">' +
                                '                            <dt>' +item.enterpriseName+
                                '                            </dt>' +
                                '                            <dd>' +
                                '                                <div class="products-info">' +
                                '                                    <div class="products-type">' +
                                '                                        <span class="products-type_item">' +
                                '                                            <span>统一社会信用代码：</span><em>'+item.socialCode+'</em>' +
                                '                                        </span>' +
                                '                                        <span class="products-type_item">' +
                                '<span>注册资金：</span><em>'+item.registeredCaptial+'</em>' +
                                '                                        </span>' +
                                '                                        <span class="products-type_item">' +
                                '<span>区域：</span><em>'+regionArr[item.region]+'</em>' +
                                '                                        </span>' +
                                '                                        <span class="products-type_item">' +
                                '<span>法人姓名：</span><em>'+item.ownerName+'</em>' +
                                '                                        </span><span class="products-type_item">' +
                                '<span>法人电话：</span><em>'+item.ownerPhone+'</em>' +
                                '                                        </span>' +
                                '                                        <span class="products-type_item">' +
                                '<span>成立时间：</span><em>'+item.establishTime.slice(0,10)+'</em>' +
                                '                                        </span>' +
                                '                                    </div>' +
                                '                                    <div class="products-action">' +
                                '                                        <p class="btn-wrap">' +
                                '<button class="products-btn products-btn--red apply apply editEnterprise" id="1'+index+'">编辑</button>' +
                                '                                            <button class="products-btn products-btn--red apply apply delete" id="'+index+'">删除</button>' +
                                '                                        </p>' +
                                '                                        <p class="proecuts-success" style="visibility: hidden">' +
                                '                                            <span class="desc">成功率</span>' +
                                '                                            <span class="score-bar">' +
                                '<span class="score" style="width: 0%;"></span>' +
                                '</span>' +
                                '                                        </p>' +
                                '                                    </div>' +
                                '                                </div>' +
                                '                            </dd>' +
                                '                        </dl>'
                        })
                        // console.log(d1)
                        $(".products-list").append(d1);
                        var btn=$("#enterprise .delete");
                        // var btn=$("#enterprise .delete");
                        var editbtn=$('#enterprise .editEnterprise');
                        for(var i=0;i<btn.length;i++){
                            btn[i].onclick=function (e) {
                                console.log(e.target);
                                $.ajax({
                                    type:'POST',
                                    url:'http://localhost:8888/admin/enterpriseManage/delete',
                                    data:{
                                        userName:result.data['enterpriseInfo List'][e.target.id].socialCode
                                    },
                                    success:function (result) {
                                        if(result.meta.success){
                                            alert("删除成功！")
                                            queryEnterprise();
                                        }else{
                                            alert("删除失败！")
                                        }
                                    },
                                    error:function(){
                                        alert("错误");
                                    }
                                })
                            }
                        }
                        for(let j=0;j<editbtn.length;j++){
                            editbtn[j].onclick=function (e) {
                                $(" .search-div").css({
                                    'display':'none'
                                })
                                // console.log(e)
                                var i=parseInt(e.target.id.slice(1))
                                $(".products-list").remove();
                                $(".card-body--padding").append('<div class="products-list"></div>');

                                // var content=$('.products_list').html()
                                console.log(result.data[i],i)
                                $("#enterprise .products-list").append(content1)
                                $('.products-list #companycode').val(result.data['enterpriseInfo List'][i].socialCode)
                                $('.products-list #pci_namecn').val(result.data['enterpriseInfo List'][i].enterpriseName)
                                $('.products-list #companyRegisterNo').val(result.data['enterpriseInfo List'][i].registeredCaptial)
                                $('.products-list #pci_branchno').val(result.data['enterpriseInfo List'][i].region)
                                $('.products-list #pci_branchno_town').val(result.data['enterpriseInfo List'][i].street)
                                $('.products-list #ownername').val(result.data['enterpriseInfo List'][i].ownerName)
                                $('.products-list #ownerno').val(result.data['enterpriseInfo List'][i].ownerPhone)
                                $('.products-list #username').val(result.data['enterpriseInfo List'][i].contactName)
                                $('.products-list #phoneno').val(result.data['enterpriseInfo List'][i].contactPhone)
                                $('.products-list #establishmentTime').val(result.data['enterpriseInfo List'][i].establishTime.slice(0,10).replace('/','-'))
                                $('.products-list #loginpwd').val(result.data['enterpriseInfo List'][i].password)
                                $('.products-list #fundQuota').val(result.data['enterpriseInfo List'][i].fundQuota)
                                $('.products-list #availableCredit').val(result.data['enterpriseInfo List'][i].available)
                                $('.products-list #registAddress').val(result.data['enterpriseInfo List'][i].establishAddress)
                                $('.products-list #businessScope').val(result.data['enterpriseInfo List'][i].businessScop)
                                $('.products-list #enterpriseDesc').val(result.data['enterpriseInfo List'][i].enterpriseDesc)
                                $('.products-list #accountBank').val(result.data['enterpriseInfo List'][i].accountBank)
                                $('.products-list #electricityChargeCode').val(result.data['enterpriseInfo List'][i].electricityChargeCode)
                                $('.products-list #socialSecurityCode').val(result.data['enterpriseInfo List'][i].socialSecurityCode)
                                console.log(result.data['enterpriseInfo List'][i].establishTime.slice(0,10).replace('/','-'))
                                $("#enterpriseOk")[0].onclick=function (e) {
                                    var d=$(".products-list #enterpriseForm").serializeObject()
                                    console.log(d)
                                    d.registeredCaptial=parseInt(d.registeredCapital)
                                    d.region=parseInt(d.region)
                                    d.socialCode=result.data['enterpriseInfo List'][i].socialCode
                                    console.log(d)
                                    // if(d.password === d.affirmpwd){
                                        $.ajax({
                                            type:'POST',
                                            url:'http://localhost:8888/enterprise/InformationModification/post',
                                            headers: {'Content-Type':'application/json'},
                                            data:JSON.stringify(d),
                                            success:function (result) {
                                                if(result.meta.success){
                                                    alert("编辑成功！")
                                                    queryEnterprise();
                                                }else{
                                                    alert("编辑失败！")
                                                }
                                            },
                                            error:function(){
                                                alert("错误");
                                            }
                                        })
                                    }
                                    console.log(d)

                                    // queryEnterprise()
                                // }
                                $("#enterpriseCancel")[0].onclick=function (e) {
                                    queryEnterprise()
                                }
                            }
                        }
                    }else{
                        alert("查询失败！")
                    }
                },
                error:function(){
                    alert("错误");
                }
            })
        }
        $("#add-enterprise")[0].onclick=function (e) {
            $(" .search-div").css({
                'display':'none'
            })
            $(".products-list").remove();
            $(".card-body--padding").append('<div class="products-list"></div>');
            $("#enterprise .products-list").append(content)
            $("#enterprise .products-list #enterpriseOk")[0].onclick=function (e) {
                // console.log(e)
                var d=$(".products-list #enterpriseForm").serializeObject()
                d.registeredCaptial=parseInt(d.registeredCapital)
                d.region=parseInt(d.region)
                console.log(d,d.password,d.affirmpwd)
                if(d.password === d.affirmpwd){
                    console.log($("#companycode").val().length)
                    if($("#companycode").val().length == 18){
                        $.ajax({
                            type : "POST",
                            url:"http://localhost:8888/enterprise/register",
                            data:d,
                    // $.ajax({
                    //     type:'POST',
                    //     url:'http://localhost:8888/enterprise/register',
                    //     data:d,
                        success:function (result) {
                            if(result.meta.success){
                                alert("新增用户成功！")
                                queryEnterprise()
                            }else{
                                alert("新增用户失败！")
                            }
                        },
                        error:function(){
                            alert("错误");
                        }
                    })
                }else{
                        alert("统一社会信用代码长度不满足18位，请仔细检查后重新填写！");
                    // alert("两次输入密码不一致")
                }
                // console.log(us)

            }else{
                    alert("两次输入密码不一致")

                }
            }
            $("#enterprise .products-list #enterpriseCancel")[0].onclick=function (e) {
                queryEnterprise()
            }
        }
        $.ajax({
            type: "POST",
            url: "http://localhost:8888/admin/enterpriseManage/check",
            // data:{
            //     pageNum:1,
            //     pageSize:10000
            // },
            success: function (result) {
                // '                                            <button class="products-btn" id="edit">编辑</button>' +
                data = result.data;
                if (data) {
                    var data1 = data.map(function (item, index) {
                        return '<dl style="padding-top: 0px;" class="products-item insurance three six twelve thirty-six credit unconnect unplicy -ten">' +
                            '                            <dt>' + item.enterpriseName +
                            '                            </dt>' +
                            '                            <dd>' +
                            '                                <div class="products-info">' +
                            '                                    <div class="products-type">' +
                            '                                        <span class="products-type_item">' +
                            '                                            <span>统一社会信用代码：</span><em>' + item.socialCode + '</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>注册资金：</span><em>' + item.registeredCaptial + '</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>区域：</span><em>' + regionArr[item.region] + '</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>法人姓名：</span><em>' + item.ownerName + '</em>' +
                            '                                        </span><span class="products-type_item">' +
                            '<span>法人电话：</span><em>' + item.ownerPhone + '</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>成立时间：</span><em>' + item.establishTime.slice(0, 10) + '</em>' +
                            '                                        </span>' +
                            '                                    </div>' +
                            '                                    <div class="products-action">' +
                            '                                        <p class="btn-wrap">' +
                            '<button class="products-btn products-btn--red apply apply editEnterprise" id="1' + index + '">编辑</button>' +
                            '                                            <button class="products-btn products-btn--red apply apply delete" id="' + index + '">删除</button>' +
                            '                                        </p>' +
                            '                                        <p class="proecuts-success" style="visibility: hidden">' +
                            '                                            <span class="desc">成功率</span>' +
                            '                                            <span class="score-bar">' +
                            '<span class="score" style="width: 0%;"></span>' +
                            '</span>' +
                            '                                        </p>' +
                            '                                    </div>' +
                            '                                </div>' +
                            '                            </dd>' +
                            '                        </dl>'
                    })
                    $(".products-list").append(data1);
                    var btn = $(".delete");
                    var editbtn = $('#enterprise .editEnterprise');
                    for (var i = 0; i < btn.length; i++) {
                        btn[i].onclick = function (e) {
                            console.log(e.target);
                            $.ajax({
                                type: 'POST',
                                url: 'http://localhost:8888/admin/enterpriseManage/delete',
                                data: {
                                    userName: data[e.target.id].socialCode
                                },
                                success: function (result) {
                                    if (result.meta.success) {
                                        alert("删除成功！")
                                        queryEnterprise();
                                    } else {
                                        alert("删除失败！")
                                    }
                                },
                                error: function () {
                                    alert("错误");
                                }
                            })
                        }
                    }
                    for (let j = 0; j < editbtn.length; j++) {
                        editbtn[j].onclick = function (e) {
                            $(" .search-div").css({
                                'display': 'none'
                            })
                            // console.log(e)
                            var i = parseInt(e.target.id.slice(1))
                            $(".products-list").remove();
                            $(".card-body--padding").append('<div class="products-list"></div>');

                            // var content=$('.products_list').html()
                            console.log(data[i], i)
                            $("#enterprise .products-list").append(content1)
                            $('.products-list #companycode').val(data[i].socialCode)
                            $('.products-list #pci_namecn').val(data[i].enterpriseName)
                            $('.products-list #companyRegisterNo').val(data[i].registeredCaptial)
                            $('.products-list #pci_branchno').val(data[i].region)
                            $('.products-list #pci_branchno_town').val(data[i].street)
                            $('.products-list #ownername').val(data[i].ownerName)
                            $('.products-list #ownerno').val(data[i].ownerPhone)
                            $('.products-list #username').val(data[i].contactName)
                            $('.products-list #phoneno').val(data[i].contactPhone)
                            $('.products-list #establishmentTime').val(data[i].establishTime)
                            $('.products-list #loginpwd').val(data[i].password)
                            $('.products-list #fundQuota').val(data[i].fundQuota)
                            $('.products-list #availableCredit').val(data[i].available)
                            $('.products-list #registAddress').val(data[i].establishAddress)
                            $('.products-list #businessScope').val(data[i].businessScop)
                            $('.products-list #enterpriseDesc').val(data[i].enterpriseDesc)
                            $('.products-list #accountBank').val(data[i].accountBank)
                            $('.products-list #electricityChargeCode').val(data[i].electricityChargeCode)
                            $('.products-list #socialSecurityCode').val(data[i].socialSecurityCode)
                            $("#enterpriseOk")[0].onclick = function (e) {
                                var d = $(".products-list #enterpriseForm").serializeObject()
                                console.log(d)
                                d.registeredCaptial = parseInt(d.registeredCapital)
                                d.region = parseInt(d.region)
                                console.log(d)
                                d.socialCode = data[i].socialCode
                                // if(d.password === d.affirmpwd){
                                $.ajax({
                                    type: 'POST',
                                    url: 'http://localhost:8888/enterprise/InformationModification/post',
                                    headers: {'Content-Type': 'application/json'},
                                    data: JSON.stringify(d),
                                    success: function (result) {
                                        if (result.meta.success) {
                                            alert("编辑成功！")
                                            queryEnterprise();
                                        } else {
                                            alert("编辑失败！")
                                        }
                                    },
                                    error: function () {
                                        alert("错误");
                                    }
                                })
                            // }


                            // queryEnterprise()
                        }
                        $("#enterpriseCancel")[0].onclick = function (e) {
                            queryEnterprise()
                        }
                    }
                }
            }


            },

            error:function(){
                alert("错误");
            }
        });

    }
    queryEnterprise();
    //-----------------获取企业列表--------------------------------
    $("#queryEnterprise").click(function () {
        queryEnterprise();
    })
    //-----------------获取金融列表--------------------------------
    $("#queryBank").click(function () {
        $(" #bank .search-div").css({
            display:'block'
        })
        var data=[]
        $(".products-list").remove();
        $(".card-body--padding").append('<div class="products-list"></div>');
        var content='<form class="form-horizontal" role="form" id="fiForm" style="margin-top:30px;">\n' +
            // '                        <div class="form-group">\n' +
            // '                            <label  class="col-sm-5 control-label tit"><span>*</span>银行行号：</label>\n' +
            // '                            <div class="col-sm-7">\n' +
            // '                                <input type="text" class="form-control default-input" id="bankId" name="bankId" style="width:280px" placeholder="" />\n' +
            // '                            </div>\n' +
            // '                            \n' +
            // '                        </div>\n' +
            // '                      \n' +
            '                        \n' +
            '<div class="form-group">\n' +
            '                            <label  class="col-sm-5 control-label tit"><span>*</span>银行行号：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="bankId" name="bankId" style="width:280px" placeholder="" />\n' +
            '                            </div>\n' +
            '                            \n' +
            '                        </div>'+
            '                        <div class="form-group">\n' +
            '                            <label  class="col-sm-5 control-label tit"><span>*</span>金融机构用户名：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="fkUserName" name="fkUserName" placeholder="" style="width:280px"/>\n' +
            '                            </div>\n' +
            '                            \n' +
            '                        </div>\n' +
            '\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label  class="col-sm-5 control-label tit">金融机构介绍：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="description" name="description" placeholder="" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\n' +
            '\t\t\t\t\t\t</div>\n' +
            '                        \n' +
            '                        \n' +
            '                        <div class="form-group">\n' +
            '                            <label for="bankName" class="col-sm-5 control-label tit"><span>*</span>银行名称：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="bankName" name="bankName" placeholder="" style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                      \n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>所属区域：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <select class="col-sm-9 selectpicker show-tick form-control" name="regin" id="regin" style="width:280px" data-live-search="true" style="width:180px">\n' +
            '                                \n' +
            '                                    <option value="0">0-碑林区</option>\n' +
            '                                    <option value="1">1-莲湖区</option>\n' +
            '                                    <option value="2">2-灞桥区</option>\n' +
            '                                    <option value="3">3-雁塔区</option>\n' +
            '                                    <option value="4">4-阎良区</option>\n' +
            '                                    <option value="5">5-未央区</option>\n' +
            '                                    <option value="6">6-新城区</option>\n' +
            '                                    <option value="7">7-长安区</option>\n' +
            '                                    <option value="8">8-临潼区</option>\n' +
            '                                </select>\t\t\t\t\t\t\t\t\t\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                        \n' +
            '                        \n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>街道/乡镇：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="street" name="street" placeholder="" style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                       \n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>联系人姓名：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="contactName" name="contactName" placeholder=""style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>联系人手机号：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="contactPhone" name="contactPhone" maxlength="11"  placeholder="" style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                        <div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>登录密码：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="password" class="form-control default-input" id="loginpwd" name="password" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label class="col-sm-5 control-label tit"><span>*</span>确认密码：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="password" class="form-control default-input" id="affirmpwd" name="affirmpwd" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>' +
            '</form>' +
            '<div class="btn-wrap" style="width: 150px;margin-right: auto;margin-left: auto">\n' +
            '                            <button id="fiOk" class="products-btn" >确定</button>\n' +
            '                            <button id="fiCancel" class="products-btn" >取消</button>\n' +
            '                        </div>'
        var content1='<form class="form-horizontal" role="form" id="fiForm" style="margin-top:30px;">\n' +
            // '                        <div class="form-group">\n' +
            // '                            <label  class="col-sm-5 control-label tit"><span>*</span>银行行号：</label>\n' +
            // '                            <div class="col-sm-7">\n' +
            // '                                <input type="text" class="form-control default-input" id="bankId" name="bankId" style="width:280px" placeholder="" />\n' +
            // '                            </div>\n' +
            // '                            \n' +
            // '                        </div>\n' +
            // '                      \n' +
            // '                        <div class="form-group">\n' +
            // '                            <label  class="col-sm-5 control-label tit"><span>*</span>金融机构用户名：</label>\n' +
            // '                            <div class="col-sm-7">\n' +
            // '                                <input type="text" class="form-control default-input" id="fkUserName" name="fkUserName" placeholder="" style="width:280px"/>\n' +
            // '                            </div>\n' +
            // '                            \n' +
            // '                        </div>\n' +
            '\n' +
            '\t\t\t\t\t\t<div class="form-group">\n' +
            '\t\t\t\t\t\t\t<label  class="col-sm-5 control-label tit">金融机构介绍：</label>\n' +
            '\t\t\t\t\t\t\t<div class="col-sm-7">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" class="form-control default-input" id="description" name="description" placeholder="" style="width:280px"/>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\n' +
            '\t\t\t\t\t\t</div>\n' +
            '                        \n' +
            '                        \n' +
            '                        <div class="form-group">\n' +
            '                            <label for="bankName" class="col-sm-5 control-label tit"><span>*</span>银行名称：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" disabled class="form-control default-input" id="bankName" name="bankName" placeholder="" style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                      \n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>所属区域：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <select class="col-sm-9 selectpicker show-tick form-control" name="regin" id="regin" style="width:280px" data-live-search="true" style="width:180px">\n' +
            '                                \n' +
            '                                    <option value="0">0-碑林区</option>\n' +
            '                                    <option value="1">1-莲湖区</option>\n' +
            '                                    <option value="2">2-灞桥区</option>\n' +
            '                                    <option value="3">3-雁塔区</option>\n' +
            '                                    <option value="4">4-阎良区</option>\n' +
            '                                    <option value="5">5-未央区</option>\n' +
            '                                    <option value="6">6-新城区</option>\n' +
            '                                    <option value="7">7-长安区</option>\n' +
            '                                    <option value="8">8-临潼区</option>\n' +
            '                                </select>\t\t\t\t\t\t\t\t\t\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                        \n' +
            '                        \n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>街道/乡镇：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="street" name="street" placeholder="" style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                       \n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>联系人姓名：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="contactName" name="contactName" placeholder=""style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +
            '                        <div class="form-group">\n' +
            '                            <label class="col-sm-5 control-label tit"><span>*</span>联系人手机号：</label>\n' +
            '                            <div class="col-sm-7">\n' +
            '                                <input type="text" class="form-control default-input" id="contactPhone" name="contactPhone" maxlength="11"  placeholder="" style="width:280px"/>\n' +
            '                            </div>\n' +
            '                        </div>\n' +

            '</form>' +
            '<div class="btn-wrap" style="width: 150px;margin-right: auto;margin-left: auto">\n' +
            '                            <button id="fiOk" class="products-btn" >确定</button>\n' +
            '                            <button id="fiCancel" class="products-btn" >取消</button>\n' +
            '                        </div>'
        var p='<form class="form-horizontal" role="form" id="pwdForm">\n' +
            '            <div class="form-group">\n' +
            '                <label  class="col-sm-4 control-label">原密码：</label>\n' +
            '                <div class="col-sm-5">\n' +
            '                    <input type="password" class="form-control" id="pwd" placeholder="请输入旧密码">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '            <div class="form-group">\n' +
            '                <label for="lastname" class="col-sm-4  control-label">新密码：</label>\n' +
            '                <div class="col-sm-5">\n' +
            '                    <input type="password" class="form-control" id="loginpwd" placeholder="请输入新密码">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '            <div class="form-group">\n' +
            '                <label for="lastname" class="col-sm-4 control-label">确认密码：</label>\n' +
            '                <div class="col-sm-5">\n' +
            '                    <input type="password" class="form-control" id="affirmpwd" placeholder="请输入新密码">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '        </form>\n' +
            '        <div class="btn-wrap" style="width: 150px;margin-right: auto;margin-left: auto">\n' +
            '            <button id="fiOk" class="products-btn" onclick="ok()">确定</button>\n' +
            '            <button id="fiCancel" class="products-btn" onclick="cancel()">取消</button>\n' +
            '        </div>'
        // $("#bank .products-list").append('<div class="search-div btn-wrap" style="margin-bottom: 20px;height: 30px">\n' +
        //     '                        <div style="float: right">\n' +
        //     '                            <input type="search" id="search-fi" placeholder="请输入机构名称"/>\n' +
        //     '                            <button  class="products-btn" style="margin-right: 20px" id="search-button">搜索</button>\n' +
        //     '                            <button class="products-btn" style="width:100px" id="add-fi">新增金融用户</button>\n' +
        //     '                        </div>\n' +
        //     '                    </div>')
        $('#search_button')[0].onclick=function (e) {
            var d=$('#search-fi').val()
            $(".products-list").remove();
            $(".card-body--padding").append('<div class="products-list"></div>');
            // $("#bank .products-list").append('<div class="search-div btn-wrap" style="margin-bottom: 20px;height: 30px">\n' +
            //     '                        <div style="float: right">\n' +
            //     '                            <input type="search" id="search-fi" placeholder="请输入机构名称"/>\n' +
            //     '                            <button  class="products-btn" style="margin-right: 20px" id="search-button">搜索</button>\n' +
            //     '                            <button class="products-btn" style="width:100px" id="add-fi">新增金融用户</button>\n' +
            //     '                        </div>\n' +
            //     '                    </div>')
            $.ajax({
                type:'POST',
                url:'http://localhost:8888/bank/getAllBankInformation',
                data:{
                    pageNum:1,
                    pageSize:10000,
                    bankName:d
                },
                success:function (result) {
                    if(result.meta.success){
                        // alert("新增用户成功！")
                        var data1=result.data['governmentPolicies List'].map(function (item,index) {
                            if(item.description==null){
                                item.description='';
                            }
                            return '<dl style="padding-top: 0px;" class="products-item insurance three six twelve thirty-six credit unconnect unplicy -ten">' +
                                '                            <dt>' +item.bankName+
                                '                            </dt>' +
                                '                            <dd>' +
                                '                                <div class="products-info">' +
                                '                                    <div class="products-type">' +
                                '                                        <span class="products-type_item">' +
                                '                                            <span>用户名：</span><em>'+item.fkUserName+'</em>' +
                                '                                        </span>' +
                                '                                        <span class="products-type_item">' +
                                '<span>区域：</span><em>'+regionArr[item.regin]+'</em>' +
                                '                                        </span>' +
                                '                                        <span class="products-type_item">' +
                                '<span>街道：</span><em>'+item.street+'</em>' +
                                '                                        </span>' +
                                '                                        <span class="products-type_item">' +
                                '<span>联系人姓名：</span><em>'+item.contactName+'</em>' +
                                '                                        </span><span class="products-type_item">' +
                                '<span>联系人电话：</span><em>'+item.contactPhone+'</em>' +
                                '                                        </span>' +
                                '                                        <span class="products-type_item">' +
                                '<span>描述：</span><em>'+item.description+'</em>' +
                                '                                        </span>' +
                                '                                    </div>' +
                                '                                    <div class="products-action">' +
                                '                                        <p class="btn-wrap">' +
                                '<button class="products-btn products-btn--red apply apply editFi" id="1'+index+'">编辑</button>' +
                                '<button class="products-btn products-btn--red apply apply editP" id="2'+index+'" style="width:100px;">修改密码</button>' +
                                '                                            <button class="products-btn products-btn--red apply apply btn-delete" id="'+index+'">删除</button>' +
                                '                                        </p>' +
                                '                                        <p class="proecuts-success" style="visibility: hidden">' +
                                '                                            <span class="desc">成功率</span>' +
                                '                                            <span class="score-bar">' +
                                '<span class="score" style="width: 0%;"></span>' +
                                '</span>' +
                                '                                        </p>' +
                                '                                    </div>' +
                                '                                </div>' +
                                '                            </dd>' +
                                '                        </dl>'
                        })
                        $(".products-list").append(data1);
                        var btn=$(".btn-delete");
                        var editbtn=$('#bank .editFi');
                        var editP=$("#bank .editP");
                        console.log(123)
                        console.log(btn);
                        for(var j=0;j<btn.length;j++){
                            btn[j].onclick=function (e) {
                                var i=parseInt(e.target.id)
                                $.ajax({
                                    type:'POST',
                                    url:'http://localhost:8888/admin/bankManage/delete',
                                    data:{
                                        userName:result.data['governmentPolicies List'][i].fkUserName
                                    },
                                    success:function (result) {
                                        if(result.meta.code=='4002'){
                                            alert("删除成功！")
                                            $("#queryBank").click();
                                        }else{
                                            alert("删除失败！")
                                        }
                                    },
                                    error:function(){
                                        alert("错误");
                                    }
                                })
                            }
                        }
                        for(let j=0;j<editbtn.length;j++){
                            editbtn[j].onclick=function (e) {
                                var i=parseInt(e.target.id.slice(1))
                                $(" #bank .search-div").css({
                                    'display':'none'
                                })
                                $(".products-list").remove();
                                $(".card-body--padding").append('<div class="products-list"></div>');
                                // var content=$('.products_list').html()
                                // console.log(content,data[i],i)
                                $("#bank .products-list").append(content1)
                                $('.products-list #fkUserName').val(result.data['governmentPolicies List'][i].fkUserName)
                                $('.products-list #bankId').val(result.data['governmentPolicies List'][i].bankId)
                                $('.products-list #description').val(result.data['governmentPolicies List'][i].description)
                                $('.products-list #bankName').val(result.data['governmentPolicies List'][i].bankName)
                                $('.products-list #regin').val(result.data['governmentPolicies List'][i].regin)
                                $('.products-list #street').val(result.data['governmentPolicies List'][i].street)
                                $('.products-list #contactName').val(result.data['governmentPolicies List'][i].contactName)
                                $('.products-list #contactPhone').val(result.data['governmentPolicies List'][i].contactPhone)
                                $('.products-list #loginpwd').val(result.data['governmentPolicies List'][i].password)
                                $("#bank .products-list #fiOk")[0].onclick=function (e) {
                                    // console.log(e)
                                    var d=$(".products-list #fiForm").serializeObject()
                                    d.regin=parseInt(d.regin)
                                    d.bankName=result.data['governmentPolicies List'][i].bankName
                                    // console.log(us)
                                    $.ajax({
                                        type:'POST',
                                        url:'http://localhost:8888/bank/modifyBankInformation',
                                        data:d,
                                        success:function (result) {
                                            if(result.meta.success){
                                                alert("编辑用户成功！")
                                                $("#queryBank").click()
                                            }else{
                                                alert("编辑用户失败！")
                                            }
                                        },
                                        error:function(){
                                            alert("错误");
                                        }
                                    })
                                }
                                $("#bank .products-list #fiCancel")[0].onclick=function (e) {
                                    $("#queryBank").click()
                                }
                            }
                        }
                        for(let i=0;i<editP.length;i++){
                            editP[i].onclick=function (e) {
                                $(" #bank .search-div").css({
                                    'display':'none'
                                })
                                $(".products-list").remove();
                                $(".card-body--padding").append('<div class="products-list"></div>');
                                // var content=$('.products_list').html()
                                // console.log(content,data[i],i)
                                $("#bank .products-list").append(p)
                                var newpwd=$("#loginpwd").val()
                                var apwd=$("#affirmpwd").val()
                                var pwd=$("#pwd").val()
                                $("#bank .products-list #fiOk")[0].onclick=function (e) {
                                    // console.log(e)
                                    console.log(newpwd,apwd,pwd)
                                    if($("#loginpwd").val()===$("#affirmpwd").val()){
                                        $.ajax({
                                            type:'POST',
                                            url:'http://localhost:8888/bank/changepassword',
                                            data:{
                                                userName:result.data['governmentPolicies List'][i].fkUserName,
                                                password:$("#bank #pwd")[0].value,
                                                newPassword:$("#bank #loginpwd")[0].value
                                            },
                                            success:function (result) {
                                                if(result.meta.success){
                                                    alert("修改成功！")
                                                    $("#queryBank").click()
                                                }else{
                                                    alert("修改失败！")
                                                }
                                            },
                                            error:function(){
                                                alert("错误");
                                            }
                                        })
                                    }else{
                                        alert("两次输入密码不一致")
                                    }

                                }
                                $("#bank .products-list #fiCancel")[0].onclick=function (e) {
                                    $("#queryBank").click()
                                }

                            }
                        }
                    }else{
                        alert("查询失败！")
                    }
                },
                error:function(){
                    alert("错误");
                }
            })
        }
        $("#add-fi")[0].onclick=function (e) {
            $(" #bank .search-div").css({
                display:'none'
            })
            $(".products-list").remove();
            $(".card-body--padding").append('<div class="products-list"></div>');

            $("#bank .products-list").append(content)
            $("#bank .products-list #fiOk")[0].onclick=function (e) {
                // console.log(e)
                var d=$(".products-list #fiForm").serializeObject()
                d.regin=parseInt(d.regin)
                // console.log(us)
                $.ajax({
                    type:'POST',
                    url:'http://localhost:8888/bank/register',
                    data:d,
                    success:function (result) {
                        if(result.meta.success){
                            alert("新增用户成功！")
                            $("#queryBank").click()
                        }else{
                            alert("新增用户失败！")
                        }
                    },
                    error:function(){
                        alert("错误");
                    }
                })
            }
            $("#bank .products-list #fiCancel")[0].onclick=function (e) {
                $("#queryBank").click()
            }
        }
        $.ajax({
            type : "POST",
            url:"http://localhost:8888/admin/bankManage/check",
            // data:{
            //     pageNum:1,
            //     pageSize:10000
            // },
            success:function(result){
                // '                                            <button class="products-btn" id="edit">编辑</button>' +
                data=result.data;
                if(data){
                    var data1=data.map(function (item,index) {
                        if(item.description==null){
                            item.description='';
                        }
                        return '<dl style="padding-top: 0px;" class="products-item insurance three six twelve thirty-six credit unconnect unplicy -ten">' +
                            '                            <dt>' +item.bankName+
                            '                            </dt>' +
                            '                            <dd>' +
                            '                                <div class="products-info">' +
                            '                                    <div class="products-type">' +
                            '                                        <span class="products-type_item">' +
                            '                                            <span>用户名：</span><em>'+item.fkUserName+'</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>区域：</span><em>'+regionArr[item.regin]+'</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>街道：</span><em>'+item.street+'</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>联系人姓名：</span><em>'+item.contactName+'</em>' +
                            '                                        </span><span class="products-type_item">' +
                            '<span>联系人电话：</span><em>'+item.contactPhone+'</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>描述：</span><em>'+item.description+'</em>' +
                            '                                        </span>' +
                            '                                    </div>' +
                            '                                    <div class="products-action">' +
                            '                                        <p class="btn-wrap">' +
                            '<button class="products-btn products-btn--red apply apply editFi" id="1'+index+'">编辑</button>' +
                            '<button class="products-btn products-btn--red apply apply editP" id="2'+index+'" style="width:100px;">修改密码</button>' +
                            '                                            <button class="products-btn products-btn--red apply apply btn-delete" id="'+index+'">删除</button>' +
                            '                                        </p>' +
                            '                                        <p class="proecuts-success" style="visibility: hidden">' +
                            '                                            <span class="desc">成功率</span>' +
                            '                                            <span class="score-bar">' +
                            '<span class="score" style="width: 0%;"></span>' +
                            '</span>' +
                            '                                        </p>' +
                            '                                    </div>' +
                            '                                </div>' +
                            '                            </dd>' +
                            '                        </dl>'
                    })
                    $(".products-list").append(data1);
                    var btn=$(".btn-delete");
                    var editbtn=$('#bank .editFi');
                    var editP=$('#bank .editP');
                    console.log(123)
                    console.log(btn);
                    for(var i=0;i<btn.length;i++){
                        btn[i].onclick=function (e) {
                            $.ajax({
                                type:'POST',
                                url:'http://localhost:8888/admin/bankManage/delete',
                                data:{
                                    userName:data[e.target.id].fkUserName
                                },
                                success:function (result) {
                                    if(result.meta.code=='4002'){
                                        alert("删除成功！")
                                        $("#queryBank").click();
                                    }else{
                                        alert("删除失败！")
                                    }
                                },
                                error:function(){
                                    alert("错误");
                                }
                            })
                        }
                    }
                    for(let j=0;j<editbtn.length;j++){
                        editbtn[j].onclick=function (e) {
                            $(" #bank .search-div").css({
                                'display':'none'
                            })
                            var i=parseInt(e.target.id.slice(1))
                            $(".products-list").remove();
                            $(".card-body--padding").append('<div class="products-list"></div>');
                            // var content=$('.products_list').html()
                            // console.log(content,data[i],i)
                            $("#bank .products-list").append(content1)
                            $('.products-list #fkUserName').val(data[i].fkUserName)
                            $('.products-list #description').val(data[i].description)
                            $('.products-list #bankName').val(data[i].bankName)
                            $('.products-list #regin').val(data[i].regin)
                            $('.products-list #street').val(data[i].street)
                            $('.products-list #contactName').val(data[i].contactName)
                            $('.products-list #contactPhone').val(data[i].contactPhone)
                            $('.products-list #loginpwd').val(data[i].password)
                            $("#bank .products-list #fiOk")[0].onclick=function (e) {
                                // console.log(e)
                                var d=$(".products-list #fiForm").serializeObject()
                                d.bankName=data[i].bankName
                                // console.log(us)
                                $.ajax({
                                    type:'POST',
                                    url:'http://localhost:8888/bank/modifyBankInformation',
                                    data:d,
                                    success:function (result) {
                                        if(result.meta.success){
                                            alert("编辑用户成功！")
                                            $("#queryBank").click()
                                        }else{
                                            alert("编辑用户失败！")
                                        }
                                    },
                                    error:function(){
                                        alert("错误");
                                    }
                                })
                            }
                            $("#bank .products-list #fiCancel")[0].onclick=function (e) {
                                $("#queryBank").click()
                            }
                        }
                    }
                    for(let i=0;i<editP.length;i++){
                        editP[i].onclick=function (e) {
                            $(" #bank .search-div").css({
                                'display':'none'
                            })
                            $(".products-list").remove();
                            $(".card-body--padding").append('<div class="products-list"></div>');
                            // var content=$('.products_list').html()
                            // console.log(content,data[i],i)
                            $("#bank .products-list").append(p)
                            var newpwd=$("#bank #loginpwd")[0].value
                            var apwd=$("#bank #affirmpwd")[0].value
                            var pwd=$("#bank #pwd")[0].value
                            var d=$("#bank .products-list #pwdForm").serializeObject()
                            console.log(d)
                            $("#bank .products-list #fiOk")[0].onclick=function (e) {
                                // console.log(e)
                                console.log(d)
                                console.log(newpwd,apwd,pwd)
                                console.log($("#bank #pwd")[0].value)
                                if($("#bank #loginpwd")[0].value===$("#bank #affirmpwd")[0].value){
                                    $.ajax({
                                        type:'POST',
                                        url:'http://localhost:8888/bank/changepassword',
                                        data:{
                                            userName:data[i].fkUserName,
                                            password:$("#bank #pwd")[0].value,
                                            newPassword:$("#bank #loginpwd")[0].value
                                        },
                                        success:function (result) {
                                            if(result.meta.success){
                                                alert("修改成功！")
                                                $("#queryBank").click()
                                            }else{
                                                alert("修改失败！")
                                            }
                                        },
                                        error:function(){
                                            alert("错误");
                                        }
                                    })
                                }else{
                                    alert("两次输入密码不一致")
                                }

                            }
                            $("#bank .products-list #fiCancel")[0].onclick=function (e) {
                                $("#queryBank").click()
                            }

                        }
                    }
                }

            },
            error:function(){
                alert("错误");
            }
        });
    })

    function cancel(){
        console.log(123)
        $(".products-list").remove();
        $(".card-body--padding").append('<div class="products-list"></div>');
        $(".products-list").append(data1);
    }
    function goverOk(){
        console.log(123)
        console.log()
    }



    //-----------------获取政府列表--------------------------------
    $("#queryGovernment").click(function () {
        $(" .search-div").css({
                'display':'block'
            })
        var data=[]
        $(".products-list").remove();
        $(".card-body--padding").append('<div class="products-list"></div>');
        // $("#government .products-list").append('<div class="search-div btn-wrap" style="margin-bottom: 20px;height: 30px">\n' +
        //         //     '                        <div style="float: right">\n' +
        //         //     '                            <input type="search" id="search-gover"/>\n' +
        //         //     '                            <button  class="products-btn" style="margin-right: 20px" id="search-button">搜索</button>\n' +
        //         //     '                            <button class="products-btn" style="width:100px" id="add-gover">新增政府用户</button>\n' +
        //         //     '                        </div>\n' +
        //         //     '                    </div>')
        $.ajax({
            type : "POST",
            url:"http://localhost:8888/admin/governmentManage/check",
            // data:{
            //     pageNum:1,
            //     pageSize:10000
            // },
            success:function(result){
                // '                                            <button class="products-btn" id="edit">编辑</button>' +
                data=result.data;

                if(data){
                    var data1=data.map(function (item,index) {
                        return '<dl style="padding-top: 0px;" class="products-item insurance three six twelve thirty-six credit unconnect unplicy -ten">' +
                            '                            <dt>' +item.fkUserName+
                            '                            </dt>' +
                            '                            <dd>' +
                            '                                <div class="products-info">' +
                            '                                    <div class="products-type">' +
                            '                                        <span class="products-type_item">' +
                            '                                            <span>政府代码：</span><em>'+item.governmentCode+'</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>部门：</span><em>'+item.departmentName+'</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>负责人姓名：</span><em>'+item.principalName+'</em>' +
                            '                                        </span>' +
                            '                                        <span class="products-type_item">' +
                            '<span>负责人电话：</span><em>'+item.principalPhone+'</em>' +
                            '                                        </span>'+
                            '                                    </div>' +
                            '                                    <div class="products-action">' +
                            '                                        <p class="btn-wrap">' +
                            '<button class="products-btn products-btn--red apply apply editGovernment" id="1'+index+'">编辑</button>' +
                            '                                            <button class="products-btn products-btn--red apply apply delete" id="'+index+'">删除</button>' +
                            '                                        </p>' +
                            '                                        <p class="proecuts-success" style="visibility: hidden">' +
                            '                                            <span class="desc">成功率</span>' +
                            '                                            <span class="score-bar">' +
                            '<span class="score" style="width: 0%;"></span>' +
                            '</span>' +
                            '                                        </p>' +
                            '                                    </div>' +
                            '                                </div>' +
                            '                            </dd>' +
                            '                        </dl>'
                    })
                    $(" .products-list").append(data1);
                    var btn=$(".delete");
                    var editbtn=$('#government .editGovernment');
                    console.log()
                    $('#search-button')[0].onclick=function (e) {
                        var d=$('#search-gover').val()
                        $.ajax({
                            type:'POST',
                            url:'http://localhost:8888/admin/governmentManage/check',
                            data:{
                                userName:d
                            },
                            success:function (result) {
                                if(result.meta.success){
                                    $(".products-list").remove();
                                    $(".card-body--padding").append('<div class="products-list"></div>');
                                    // $("#government .products-list").append('<div class="search-div btn-wrap" style="margin-bottom: 20px;height: 30px">\n' +
                                    //     '                        <div style="float: right">\n' +
                                    //     '                            <input type="search" id="search-gover"/>\n' +
                                    //     '                            <button  class="products-btn" style="margin-right: 20px" id="search-button">搜索</button>\n' +
                                    //     '                            <button class="products-btn" style="width:100px" id="add-gover">新增政府用户</button>\n' +
                                    //     '                        </div>\n' +
                                    //     '                    </div>')
                                    // alert("新增用户成功！")
                                    // $("#queryGovernment").click()
                                    var data1=result.data.map(function (item,index) {
                                        return '<dl style="padding-top: 0px;" class="products-item insurance three six twelve thirty-six credit unconnect unplicy -ten">' +
                                            '                            <dt>' +item.fkUserName+
                                            '                            </dt>' +
                                            '                            <dd>' +
                                            '                                <div class="products-info">' +
                                            '                                    <div class="products-type">' +
                                            '                                        <span class="products-type_item">' +
                                            '                                            <span>政府代码：</span><em>'+item.governmentCode+'</em>' +
                                            '                                        </span>' +
                                            '                                        <span class="products-type_item">' +
                                            '<span>部门：</span><em>'+item.departmentName+'</em>' +
                                            '                                        </span>' +
                                            '                                        <span class="products-type_item">' +
                                            '<span>负责人姓名：</span><em>'+item.principalName+'</em>' +
                                            '                                        </span>' +
                                            '                                        <span class="products-type_item">' +
                                            '<span>负责人电话：</span><em>'+item.principalPhone+'</em>' +
                                            '                                        </span>'+
                                            '                                    </div>' +
                                            '                                    <div class="products-action">' +
                                            '                                        <p class="btn-wrap">' +
                                            '<button class="products-btn products-btn--red apply apply editGovernment" id="1'+index+'">编辑</button>' +
                                            '                                            <button class="products-btn products-btn--red apply apply delete" id="'+index+'">删除</button>' +
                                            '                                        </p>' +
                                            '                                        <p class="proecuts-success" style="visibility: hidden">' +
                                            '                                            <span class="desc">成功率</span>' +
                                            '                                            <span class="score-bar">' +
                                            '<span class="score" style="width: 0%;"></span>' +
                                            '</span>' +
                                            '                                        </p>' +
                                            '                                    </div>' +
                                            '                                </div>' +
                                            '                            </dd>' +
                                            '                        </dl>'
                                    })
                                    $(" .products-list").append(data1);
                                    var btn=$(".delete");
                                    var editbtn=$('#government .editGovernment');
                                    console.log()
                                    // $('#search-button')[0].onclick=function (e) {
                                    //     var d=$('#search-gover').val()
                                    //     $.ajax({
                                    //         type:'POST',
                                    //         url:'http://localhost:8888/admin/governmentManage/check',
                                    //         data:{
                                    //             userName:d
                                    //         },
                                    //         success:function (result) {
                                    //             if(result.meta.success){
                                    //                 $(".products-list").remove();
                                    //                 $(".card-body--padding").append('<div class="products-list"></div>');
                                    //                 $("#government .products-list").append('<div class="search-div btn-wrap" style="margin-bottom: 20px;height: 30px">\n' +
                                    //                     '                        <div style="float: right">\n' +
                                    //                     '                            <input type="search" id="search-gover"/>\n' +
                                    //                     '                            <button  class="products-btn" style="margin-right: 20px" id="search-button">搜索</button>\n' +
                                    //                     '                            <button class="products-btn" style="width:100px" id="add-gover">新增政府用户</button>\n' +
                                    //                     '                        </div>\n' +
                                    //                     '                    </div>')
                                    //                 // alert("新增用户成功！")
                                    //                 // $("#queryGovernment").click()
                                    //
                                    //             }else{
                                    //                 alert("新增用户失败！")
                                    //             }
                                    //         },
                                    //         error:function(){
                                    //             alert("错误");
                                    //         }
                                    //     })
                                    // }
                                    $("#add-gover")[0].onclick=function (e) {
                                        $(" #bank .search-div").css({
                                            display:'none'
                                        })
                                        $(".products-list").remove();
                                        $(".card-body--padding").append('<div class="products-list"></div>');
                                        var content = $('.products_list').html()
                                        $("#government .products-list").append(content)
                                        $("#government .products-list #goverOk")[0].onclick=function (e) {
                                            // console.log(e)
                                            var us = $(".products-list #goverForm").serializeObject();
                                            console.log(us)
                                            $.ajax({
                                                type:'POST',
                                                url:'http://localhost:8888/admin/governmentManage/add',
                                                data:us,
                                                success:function (result) {
                                                    if(result.meta.success){
                                                        alert("新增用户成功！")
                                                        $("#queryGovernment").click()
                                                    }else{
                                                        alert("新增用户失败！")
                                                    }
                                                },
                                                error:function(){
                                                    alert("错误");
                                                }
                                            })
                                        }
                                    }
                                    for(var i=0;i<btn.length;i++){
                                        btn[i].onclick=function (e) {
                                            var j=e.target.id
                                            $.ajax({
                                                type:'POST',
                                                url:'http://localhost:8888/admin/governmentManage/delete',
                                                data:{
                                                    userName:result.data[j].fkUserName
                                                },
                                                success:function (result) {
                                                    if(result.meta.success){
                                                        alert("删除成功！")
                                                        $("#queryGovernment").click();
                                                    }else{
                                                        alert("删除失败！")
                                                    }
                                                },
                                                error:function(){
                                                    alert("错误");
                                                }
                                            })
                                        }
                                    }
                                    for(let j=0;j<editbtn.length;j++){
                                        editbtn[j].onclick=function (e) {
                                            $(" .search-div").css({
                                                'display':'none'
                                            })
                                            var i=parseInt(e.target.id.slice(1))
                                            $(".products-list").remove();
                                            $(".card-body--padding").append('<div class="products-list"></div>');
                                            // var content = '<div class="btn-wrap">\n' +
                                            //     '                            <form id="goverForm" style="padding-left: 30px;padding-top: 30px">\n' +
                                            //     '                                <label style="margin-right: 10px">用户名</label><input id="governUserName" name="userName" type="text"/><br/><br/>\n' +
                                            //     '                                <label style="margin-right: 10px">政府编码</label><input id="governmentCode" name="governmentCode" type="number"/><br/><br/>\n' +
                                            //     '                                <label style="margin-right: 10px">部门名称</label><input id="departmentName" name="departmentName" type="text"/><br/><br/>\n' +
                                            //     '                                <label style="margin-right: 10px">部门负责人姓名</label><input id="principalName" name="principalName" type="text"/><br/><br/>\n' +
                                            //     '                                <label style="margin-right: 10px">部门负责人手机号</label><input id="principalPhone" name="principalPhone" type="text"/><br/><br/>\n' +
                                            //     '                            </form>\n' +
                                            //     '                            <button id="goverOk" class="products-btn" >确定</button>\n' +
                                            //     '                            <button id="goverCancel" class="products-btn">取消</button>\n' +
                                            //     '                        </div>'
                                            var content=$('.products_list').html()
                                            // console.log(content,data[i],i)
                                            $("#government .products-list").append(content)
                                            $('.products-list #governUserName').val(result.data[i].fkUserName)
                                            $('.products-list #governmentCode').val(result.data[i].governmentCode)
                                            $('.products-list #departmentName').val(result.data[i].departmentName)
                                            $('.products-list #principalName').val(result.data[i].principalName)
                                            $('.products-list #principalPhone').val(result.data[i].principalPhone)
                                        }
                                    }

                                }else{
                                    alert("新增用户失败！")
                                }
                            },
                            error:function(){
                                alert("错误");
                            }
                        })
                    }
                    $("#add-gover")[0].onclick=function (e) {
                        $(".products-list").remove();
                        $(".card-body--padding").append('<div class="products-list"></div>');
                        var content = $('.products_list').html()
                        $("#government .products-list").append(content)
                        $("#government .products-list #goverOk")[0].onclick=function (e) {
                            // console.log(e)
                            var us = $(".products-list #goverForm").serializeObject();
                            console.log(us)
                            $.ajax({
                                type:'POST',
                                url:'http://localhost:8888/admin/governmentManage/add',
                                data:us,
                                success:function (result) {
                                    if(result.meta.success){
                                        alert("新增用户成功！")
                                        $("#queryGovernment").click()
                                    }else{
                                        alert("新增用户失败！")
                                    }
                                },
                                error:function(){
                                    alert("错误");
                                }
                            })
                        }
                    }
                    for(var i=0;i<btn.length;i++){
                        btn[i].onclick=function (e) {
                            $.ajax({
                                type:'POST',
                                url:'http://localhost:8888/admin/governmentManage/delete',
                                data:{
                                    userName:data[parseInt(e.target.id)].fkUserName
                                },
                                success:function (result) {
                                    if(result.meta.success){
                                        alert("删除成功！")
                                        $("#queryGovernment").click();
                                    }else{
                                        alert("删除失败！")
                                    }
                                },
                                error:function(){
                                    alert("错误");
                                }
                            })
                        }
                    }
                    for(let j=0;j<editbtn.length;j++){
                        editbtn[j].onclick=function (e) {
                            $(".search-div").css({
                                'display':'none'
                            })
                            var i=parseInt(e.target.id.slice(1))
                            $(".products-list").remove();
                            $(".card-body--padding").append('<div class="products-list"></div>');
                            // var content = '<div class="btn-wrap">\n' +
                            //     '                            <form id="goverForm" style="padding-left: 30px;padding-top: 30px">\n' +
                            //     '                                <label style="margin-right: 10px">用户名</label><input id="governUserName" name="userName" type="text"/><br/><br/>\n' +
                            //     '                                <label style="margin-right: 10px">政府编码</label><input id="governmentCode" name="governmentCode" type="number"/><br/><br/>\n' +
                            //     '                                <label style="margin-right: 10px">部门名称</label><input id="departmentName" name="departmentName" type="text"/><br/><br/>\n' +
                            //     '                                <label style="margin-right: 10px">部门负责人姓名</label><input id="principalName" name="principalName" type="text"/><br/><br/>\n' +
                            //     '                                <label style="margin-right: 10px">部门负责人手机号</label><input id="principalPhone" name="principalPhone" type="text"/><br/><br/>\n' +
                            //     '                            </form>\n' +
                            //     '                            <button id="goverOk" class="products-btn" >确定</button>\n' +
                            //     '                            <button id="goverCancel" class="products-btn">取消</button>\n' +
                            //     '                        </div>'
                            var content=$('.products_list').html()
                            // console.log(content,data[i],i)
                            $("#government .products-list").append(content)
                            $('.products-list #governUserName').val(data[i].fkUserName)
                            $('.products-list #governmentCode').val(data[i].governmentCode)
                            $('.products-list #departmentName').val(data[i].departmentName)
                            $('.products-list #principalName').val(data[i].principalName)
                            $('.products-list #principalPhone').val(data[i].principalPhone)
                        }
                    }
                }

            },
            error:function(){
                alert("错误");
            }
        });
    })
    //----------------我的需求------------------------
    $("#queryenterpriseDemand").click(function (e) {
        $("#my-demand-tbody").remove()
        $("#enterpriseRequirement table").append('<tbody id="my-demand-tbody"></tbody>')
        var guaranteeMode=['抵押','信保基金','一般保证','信用','实际控制人夫妇提供个人连带担保'];
        $.ajax({
            type:'POST',
            url:'http://localhost:8888/enterprise/getAllPublicReq',
            data:{
                pageNum:1,
                pageSize:10000
            },
            success:function (result) {
                if(result.meta.success){
                    var d=result.data["enterpriseReqList List"].map(function (item) {
                        return '<tr>\n' +
                            '                                <td>'+item.enterpriseName+'</td>\n' +
                            '                                <td>'+item.fkSocialCode+'</td>\n' +
                            '                                <td>'+item.loanLimit+'万</td>\n' +
                            '                                <td>'+item.rateUpperLimit+'%</td>\n' +
                            '                                <td>'+item.rateLowerLimit+'%</td>\n' +
                            '                                <td>'+item.loanPeriod+'</td>\n' +
                            '                                <td>'+guaranteeMode[item.guaranteeMode]+'</td>\n' +
                            '                               <td>'+item.financingPurposes+'</td>\n' +
                            '                                <td>'+item.projectSituation+'</td>\n' +
                            '                               <td>'+item.remark+'</td>\n'+
                            '                          </tr>'
                    })
                    $("#my-demand-tbody").append(d)

                }else{
                    alert("获取失败！")
                }
            },
            error:function(){
                alert("错误");
            }
        })
        $("#mydemand-btn")[0].onclick=function (e) {
            $("#my-demand-tbody").remove()
            $("#enterpriseRequirement table").append('<tbody id="my-demand-tbody"></tbody>')
            var enterpriseName=$("#enterpriseName").val()
            var socialCode=$("#socialCode").val()
            var d={
                pageNum:1,
                pageSize:10000,
            }
            if(enterpriseName !== ''){
                d.enterpriseName=enterpriseName
            }
            socialCode!==''? d.socialCode=socialCode:null
            $.ajax({
                type:'POST',
                url:'http://localhost:8888/enterprise/getAllPublicReq',
                data:d,
                success:function (result) {
                    if(result.meta.success){
                        var d=result.data["enterpriseReqList List"].map(function (item) {
                            return '<tr>\n' +
                                '                                <td>'+item.enterpriseName+'</td>\n' +
                                '                                <td>'+item.fkSocialCode+'</td>\n' +
                                '                                <td>'+item.loanLimit+'万</td>\n' +
                                '                                <td>'+item.rateUpperLimit+'%</td>\n' +
                                '                                <td>'+item.rateLowerLimit+'%</td>\n' +
                                '                                <td>'+item.loanPeriod+'</td>\n' +
                                '                                <td>'+guaranteeMode[item.guaranteeMode]+'</td>\n' +
                                '                               <td>'+item.financingPurposes+'</td>\n' +
                                '                                <td>'+item.projectSituation+'</td>\n' +
                                '                               <td>'+item.remark+'</td>\n'+
                                '                          </tr>'
                        })
                        $("#my-demand-tbody").append(d)

                    }else{
                        alert("获取失败！")
                    }
                },
                error:function(){
                    alert("错误");
                }
            })

        }
        $("#downloadRequirement").click(function (e) {
            var blob = new Blob([document.getElementById("requirement_table").outerHTML], {
                type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
            });
            saveAs(blob, "export.xls");
            $("#queryenterpriseDemand").click()
        })
    })
    $("#queryproduction").click(function (e) {
        $("#my-production-tbody").remove()
        $("#bankProduction table").append('<tbody id="my-production-tbody"></tbody>')
        var guaranteeMode=['抵押','信保基金','一般保证','信用','实际控制人夫妇提供个人连带担保'];
        var month={
            Jan:1,
            Feb:2,
            Mar:3,
            Apr:4,
            May:5,
            Jun:6,
            Jul:7,
            Aug:8,
            Sept:9,
            Oct:10,
            Nov:11,
            Dec:12
        }
        $.ajax({
            type:'POST',
            url:'http://localhost:8888/enterprise/getAllProductRequest',
            data:{
                pageNum:1,
                pageSize:10000
            },
            success:function (result) {
                if(result.meta.success){
                    var d=result.data["productRequest List"].map(function (item) {
                        var times=item.requestTime.split(' ')
                        return '<tr>\n' +
                            '                                <td>'+item.enterpriseName+'</td>\n' +
                            '                                <td>'+item.productName+'</td>\n' +
                            '                                <td>'+item.bankName+'</td>\n' +
                            '                                <td>'+times[5]+'-'+month[times[1]]+'-'+times[2]+' '+times[3]+'</td>\n' +
                            '                                <td>'+item.money+'万</td>\n' +
                            '                                <td>'+item.fundUsage+'</td>\n' +
                            '                               <td>'+item.status+'</td>\n' +
                            '                          </tr>'})
                    $("#my-production-tbody").append(d)

                }else{
                    alert("获取失败！")
                }
            },
            error:function(){
                alert("错误");
            }
        })
        $("#search-btn")[0].onclick=function (e) {
            $("#my-production-tbody").remove()
            $("#bankProduction table").append('<tbody id="my-production-tbody"></tbody>')
            var enterpriseName=$("#enterprise-name").val()
            var socialCode=$("#social-code").val()
            var productName=$("#productName").val()
            var bankName=$("#bankName").val()
            var d={
                pageNum:1,
                pageSize:10000,
            }
            if(enterpriseName !== ''){
                d.enterpriseName=enterpriseName
            }
            socialCode!==''? d.socialCode=socialCode:null
            productName!==''? d.productName=productName:null
            bankName!==''? d.bankName=bankName:null
            $.ajax({
                type:'POST',
                url:'http://localhost:8888/enterprise/getAllProductRequest',
                data:d,
                success:function (result) {
                    if(result.meta.success){
                        var d=result.data["productRequest List"].map(function (item) {

                            var times=item.requestTime.split(' ')
                            return '<tr>\n' +
                                '                                <td>'+item.enterpriseName+'</td>\n' +
                                '                                <td>'+item.productName+'</td>\n' +
                                '                                <td>'+item.bankName+'</td>\n' +
                                '                                <td>'+times[5]+'-'+month[times[1]]+'-'+times[2]+' '+times[3]+'</td>\n' +
                                '                                <td>'+item.money+'万</td>\n' +
                                '                                <td>'+item.fundUsage+'</td>\n' +
                                '                               <td>'+item.status+'</td>\n' +
                                '                          </tr>'
                        })
                        $("#my-production-tbody").append(d)

                    }else{
                        alert("获取失败！")
                    }
                },
                error:function(){
                    alert("错误");
                }

            })

        }
        $("#downloadPro").click(function (e) {
            var blob = new Blob([document.getElementById("production_table").outerHTML], {
                type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
            });
            saveAs(blob, "export.xls");
            $("#queryproduction").click()
        })
    })
    //--------------已成交记录----------
    $("#querysuccess").click(function (e) {
        $("#my-success-tbody").remove()
        $("#success table").append('<tbody id="my-success-tbody"></tbody>')
        var guaranteeMode=['抵押','信保基金','一般保证','信用','实际控制人夫妇提供个人连带担保'];

        $.ajax({
            type:'POST',
            url:'http://localhost:8888/getDealProduct',
            data:{
                pageNum:1,
                pageSize:10000
            },
            success:function (result) {
                if(result.meta.success){
                    var d=result.data["dealProducts List"].map(function (item) {
                        return '<tr>\n' +
                            '                                <td>'+item.enterpriseName+'</td>\n' +
                            '                                <td>'+item.socialCode+'</td>\n' +
                            '                                <td>'+item.productName+'</td>\n' +
                            '                                <td>'+item.bankName+'</td>\n' +
                            '                                <td>'+item.amountLoanLimit+'</td>\n' +
                            '                               <td>'+item.dealTime+'</td>\n' +
                            '                          </tr>'})
                    $("#my-success-tbody").append(d)

                }else{
                    alert("获取失败！")
                }
            },
            error:function(){
                alert("错误");
            }
        })
        $("#search_btn")[0].onclick=function (e) {
            $("#my-success-tbody").remove()
            $("#success table").append('<tbody id="my-success-tbody"></tbody>')
            var enterpriseName=$("#enterprise_name").val()
            var socialCode=$("#social_code").val()
            var productName=$("#product_name").val()
            var bankName=$("#bank_name").val()
            var d={
                pageNum:1,
                pageSize:10000,
            }
            if(enterpriseName !== ''){
                d.enterpriseName=enterpriseName
            }
            socialCode!==''? d.socialCode=socialCode:null
            productName!==''? d.productName=productName:null
            bankName!==''? d.bankName=bankName:null
            $.ajax({
                type:'POST',
                url:'http://localhost:8888/getDealProduct',
                data:d,
                success:function (result) {
                    if(result.meta.success){
                        var d=result.data["dealProducts List"].map(function (item) {
                            return '<tr>\n' +
                                '                                <td>'+item.enterpriseName+'</td>\n' +
                                '                                <td>'+item.socialCode+'</td>\n' +
                                '                                <td>'+item.productName+'</td>\n' +
                                '                                <td>'+item.bankName+'</td>\n' +
                                '                                <td>'+item.amountLoanLimit+'</td>\n' +
                                '                               <td>'+item.dealTime+'</td>\n' +
                                '                          </tr>'
                        })
                        $("#my-success-tbody").append(d)

                    }else{
                        alert("获取失败！")
                    }
                },
                error:function(){
                    alert("错误");
                }
            })

        }
        $("#downloadDeal").click(function (e) {
            var blob = new Blob([document.getElementById("dealTable").outerHTML], {
                type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
            });
            saveAs(blob, "export.xls");
            $("#querysuccess").click()
        })
    })
$("#release").click(function () {
    var policyName=$("#new-name").val()
    var policyDesc=$("#new-desc").val()
    $.ajax({
        type:'POST',
        url:'http://localhost:8888/government/releaseNews',
        data:{
            userName:'admin',
            newName:policyName,
            newDesc:policyDesc
        },
        success:function (result) {
            if(result.meta.success){
                alert("发布成功")
            }else{
                alert("发布失败！")
            }
        },
        error:function(){
            alert("错误");
        }
    })
})

    //---------------------退出
    $(".exit").click(function(){
        alert("退出登录！");
        window.localStorage.clear();
        window.location.href = "index.html";
    });
});